package technology.java;

import java.nio.charset.Charset;
import java.util.Arrays;

public class tsStringBuilder {
    public static void main(String[] args) {

        StringBuilder sb2 = new StringBuilder();
        System.out.println(sb2.capacity());
        StringBuilder sb = new StringBuilder("0123吧!");
        System.out.println(sb.capacity());
        sb.insert(3, "哈哈哈");

        System.out.println( sb.capacity());
        System.out.println(sb); // 012哈哈哈3吧！





    }

    private static void ts1(){


        System.out.println("----------------------------------------------------------------");
        StringBuilder sab = new StringBuilder("012345的脸蛋");
        sab.delete(3, 4);//索引删除 [从 start 到 end-1 ]
        System.out.println(sab); // 输出结果为：01245的脸蛋

//        StringBuilder sb = new StringBuilder();
//        sb.append(8).append("乘以").append(6.6);
//        sb.append(new StringBuilder("!!!"));
//        System.out.println(sb); // 8乘以6.6!!!

//        StringBuilder sb = new StringBuilder("11来过上海22");
//        System.out.println(sb);// 11来过上海22
//        sb.reverse();
//        System.out.println(sb); // 22海上过来11

        StringBuilder sb = new StringBuilder("春眠不觉晓，处处闻啼鸟。哈哈哈");
        System.out.println(sb);// 春眠不觉晓，处处闻啼鸟。哈哈哈
        System.out.println(sb.length()); //15
        sb.replace(8, 11, "蚊子咬");// [start，end）：闻index=8，鸟index=10
        System.out.println(sb); // 春眠不觉晓，处处蚊子咬。哈哈哈
//c语言1个汉字占2个字符。java的1个汉字占1个字符


        System.out.println(sb.charAt(0));
//        System.out.println(Arrays.toString(chars));
        String ss = new String("好呀aa");
        System.out.println(ss.charAt(0) + "--"+ss.charAt(2));//好--a
        System.out.println(Charset.defaultCharset());// UTF-8

        char a= (char) Integer.MAX_VALUE;
        System.out.println((int)a);

    }





}
